package hb.software.attendance.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.ExampleMatcher;
import org.springframework.data.domain.ExampleMatcher.GenericPropertyMatchers;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import hb.software.attendance.dao.AttendanceRecordDao;
import hb.software.attendance.domain.AttendanceRecord;
import hb.software.attendance.service.AttendanceRecordManager;
import hb.software.service.impl.GenericManagerImpl;

/** 
 * @ClassName: AttendanceRecordManagerImpl 
 * @Description: Crud's service of AttendanceRecord module
 * @author WangPeiDong
 * @date May 27, 2020 7:47:25 PM 
 *  
 */
@Service("attendanceRecordManager")
@Transactional
public class AttendanceRecordManagerImpl extends GenericManagerImpl<AttendanceRecord, Long>implements AttendanceRecordManager{
	AttendanceRecordDao attendanceRecordDao;
	public List<AttendanceRecord> findByName(String name) {
		
		AttendanceRecord queryObject = new AttendanceRecord();
		queryObject.setName(name);
		ExampleMatcher matcher = ExampleMatcher.matching() 
				.withMatcher("name", GenericPropertyMatchers.startsWith()) 
				.withIgnorePaths("dateCreated", "dateModified");
		
		Example<AttendanceRecord> ex = Example.of(queryObject, matcher);
		List<AttendanceRecord> result = dao.findAll(ex);
		return result;
	}
	@Autowired
	public void setAttendanceRecordDao(AttendanceRecordDao attendanceRecordDao) {
		this.attendanceRecordDao = attendanceRecordDao;
		this.dao=this.attendanceRecordDao;
	}

	
}

